<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-#37A2E9 sidebar-mini" style="background-color: #ECF0F5; ">
<section class="content-header">

    <!--第一行-->
    <div class="row">
        <div class="col-md-12">
            <div class="box" style="border-top:none; ">
                <!--<div class="box-header with-border" style=" background-color: #fff;">-->
                <!--<h3 class="box-title" style="font-family: 'Microsoft YaHei UI';">待处理任务</h3>-->
                <!--</div>-->
                <div class="box-body" style=" background-color: #fff;">
                    <div class="row">
                        <div class="col-lg-2 col-xs-2">
                            <!-- small box -->
                            <div class="small-box" style="background-color: #A794FE; color: #fff;margin-bottom: 0px;">
                                <div class="inner">
                                    <p>概算待审核任务</p>
                                    <h3 th:text="${totalCnt.unAppGaiSuan}">150</h3>
                                    <p th:text="${'待创建任务：'+totalCnt.unCreGaiSuan}">150</p>
                                </div>

                                <!-- <a href="#" class="small-box-footer">数据明细&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i class="fa fa-arrow-circle-right"></i></a> -->
                            </div>
                        </div>

                        <div class="col-lg-2 col-xs-2">
                            <!-- small box -->
                            <div class="small-box" style="background-color: #F97186; color: #fff;margin-bottom: 0px;">
                                <div class="inner">
                                    <p>预算待审核任务</p>
                                    <h3 th:text="${totalCnt.unAppYuSuan}">150</h3>
                                    <p th:text="${'待创建任务：'+totalCnt.unCreYuSuan}">待创建任务：150</p>
                                </div>

                                <!-- <a href="#" class="small-box-footer">数据明细&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i class="fa fa-arrow-circle-right"></i></a> -->
                            </div>
                        </div>
                        <div class="col-lg-2 col-xs-2">
                            <!-- small box -->
                            <div class="small-box"  style="background-color:#B165FB; color: #fff;margin-bottom: 0px;">
                                <div class="inner">
                                    <p>报价待审核任务</p>
                                    <h3 th:text="${totalCnt.unAppBaoJia}">150</h3>
                                    <p th:text="${'待创建任务：'+totalCnt.unCreBaoJia}">待创建任务：150</p>
                                </div>

                                <!-- <a href="#" class="small-box-footer">数据明细&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i class="fa fa-arrow-circle-right"></i></a> -->
                            </div>
                        </div>
                        <div class="col-lg-2 col-xs-2">
                            <!-- small box -->
                            <div class="small-box" style="background-color:#41E3D3; color: #fff;margin-bottom: 0px;">
                                <div class="inner">
                                    <p>合同待审核任务</p>
                                    <h3 th:text="${totalCnt.unAppHeTong}">150</h3>
                                    <p th:text="${'待创建任务：'+totalCnt.unCreHeTong}">待创建任务：150</p>
                                </div>

                                <!-- <a href="#" class="small-box-footer">数据明细&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i class="fa fa-arrow-circle-right"></i></a> -->
                            </div>
                        </div>
                        <div class="col-lg-2 col-xs-2">
                            <!-- small box -->
                            <div class="small-box" style="background-color:#F9D27F; color: #fff;margin-bottom: 0px;">
                                <div class="inner">
                                    <p>款票待审核任务</p>
                                    <h3 th:text="${totalCnt.unAppKuanPiao}">150</h3>
                                    <p th:text="${'待创建任务：'+totalCnt.unCreKuanPiao}">待创建任务：150</p>
                                </div>

                                <!-- <a href="#" class="small-box-footer">数据明细&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i class="fa fa-arrow-circle-right"></i></a> -->
                            </div>
                        </div>
                        <div class="col-lg-2 col-xs-2">
                            <!-- small box -->
                            <div class="small-box" style="background-color:#58B5FB; color: #fff;margin-bottom: 0px;">
                                <div class="inner">
                                    <p>核算待审核任务</p>
                                    <h3 th:text="${totalCnt.unAppHeSuan}">150</h3>
                                    <p th:text="${'待创建任务：'+totalCnt.unCreHeSuan}">待创建任务：150</p>
                                </div>

                                <!-- <a href="#" class="small-box-footer">数据明细&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i class="fa fa-arrow-circle-right"></i></a> -->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!--第二行-->
    <div class="row">
        <div class="col-md-9">
            <div class="row">
                <div class="col-md-4">
                    <div class="info-box" style="background-color: #39CCCC;">
                        <span class="info-box-icon"><i class="fa fa-clipboard" style="color:#fff;"></i></span>
                        <div class="info-box-content">
                            <span class="info-box-text"><b>总项目统计</b></span>
                            <span class="info-box-number">未完成：<span id="all_01">2335</span></span>
                            <div class="progress">
                                <div class="progress-bar" style="width: 70%"></div>
                            </div>
                            <span class="progress-description">总数：<span id="all_02">3547</span>&nbsp;完成：<span id="all_03">838</span></span>
                        </div>
                    </div>

                </div>
                <div class="col-md-4">
                    <div class="info-box" style="background-color: #39CCCC;">
                        <span class="info-box-icon"><i class="fa fa-clipboard" style="color:#fff;"></i></span>
                        <div class="info-box-content">
                            <span class="info-box-text"><a id="project-year-pre" href="javascript:void(0);" class="fa fa-arrow-left" style="color: #FFF" onclick="preYear()"></a>&nbsp;&nbsp;<b><span class="year" th:text="${year}" id="year">2020</span>年项目统计</b>&nbsp;&nbsp;<a id="project-year-next" href="javascript:void(0);" style="color: #FFF" class="fa fa-arrow-right" onclick="nextYear()"></a></span>
                            <span id="project-year-title" class="info-box-number">完成：<span id="year_01">451</span></span>
                            <div class="progress">
                                <div class="progress-bar" style="width: 70%"></div>
                            </div>
                            <span class="progress-description">总数：<span id="year_02">1141</span>&nbsp;未完成：<span id="year_03">1033</span></span>
                        </div>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="info-box" style="background-color: #39CCCC;">
                        <span class="info-box-icon"><i class="fa fa-clipboard" style="color:#fff;"></i></span>
                        <div class="info-box-content">
                            <span class="info-box-text"><a id="project-month-pre" href="javascript:void(0);"  onclick="preMonth()" class="fa fa-arrow-left" style="color: #FFF"></a>&nbsp;&nbsp;<b><span  class="month" th:text="${month}" id="month">12</span>月项目统计</b>&nbsp;&nbsp;<a id="project-month-next" href="javascript:void(0);" style="color: #FFF" class="fa fa-arrow-right" onclick="nextMonth()"></a></span>
                            <span class="info-box-number">完成：<span id="month_01">6</span></span>
                            <div class="progress">
                                <div class="progress-bar" style="width: 70%"></div>
                            </div>
                            <span class="progress-description">总数：<span id="month_02">28</span>&nbsp;未完成：<span id="month_03">27</span></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <div class="box" style="border-top: 0px; ">
                    <div class="box-body">
                        <div class="chart">
                            <div id="main" style="width: 800px;height:500px;margin: 3px auto ">

                            </div>
                        </div>
                    </div>
            </div>
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <div class="box  box-widget widget-user-2">
                <div class="widget-user-header" style="background-color: #1AB0AF;">
                    <div class="widget-user-image">
                        <img class="img-circle" src="../img/daiban.jpg" alt="User Avatar">
                    </div>
                    <h3 class="widget-user-username" style="line-height:2.2;color:#f0f0f0;">个人待办事项</h3>
                    <!--<h5 class="widget-user-desc">Personal to-do work</h5>-->
                </div>
                <!---->
                <!--<div class="widget-user-header bg-yellow">-->
                <!--<i class="fa fa-pencil-square-o img-circle " style="font-size:40px;"></i>-->
                <!--<h3 class="widget-user-username pull-right">个人待办事项</h3>-->

                <!--</div>-->
                <!-- /.box-header -->
                <div class="box-body no-padding" style="height: 525px;">
                    <table class="table">
                        <tbody>
                        <tr th:if="${unAppInfo.unAppGaiSuan} ne 0">
                            <td style="color: #333; width: 80%;text-align: left; text-indent:1em;">待概算审核任务</td>
                            <td><span class="badge bg-red" th:text="${unAppInfo.unAppGaiSuan}">20</span></td>
                        </tr>
                        <tr th:if="${unAppInfo.unAppYuSuan} ne 0">
                            <td style="color: #333; width: 80%;text-align: left;text-indent:1em;">待预算审核任务</td>
                            <td><span class="badge bg-yellow" th:text="${unAppInfo.unAppYuSuan}">70</span></td>
                        </tr>
                        <tr th:if="${unAppInfo.unAppBaoJia} ne 0">
                            <td style="color: #333; width: 80%;text-align: left;text-indent:1em;">待报价审核任务</td>
                            <td><span class="badge bg-green" th:text="${unAppInfo.unAppBaoJia}">90</span></td>
                        </tr>
                        <tr th:if="${unAppInfo.unAppHeTong} ne 0">
                            <td style="color: #333; width: 80%;text-align: left; text-indent:1em;">待合同审核任务</td>
                            <td><span class="badge bg-red" th:text="${unAppInfo.unAppHeTong}">20</span></td>
                        </tr>
                        <tr th:if="${unAppInfo.unAppKuanPiao} ne 0">
                            <td style="color: #333; width: 80%;text-align: left;text-indent:1em;">待款票审核任务</td>
                            <td><span class="badge bg-yellow" th:text="${unAppInfo.unAppKuanPiao}">70</span></td>
                        </tr>
                        <tr th:if="${unAppInfo.unAppHeSuan} ne 0">
                            <td style="color: #333; width: 80%;text-align: left;text-indent:1em;">待核算审核任务</td>
                            <td><span class="badge bg-light-#37A2E9" th:text="${unAppInfo.unAppHeSuan}">30</span></td>
                        </tr>
                        </tbody></table>
                </div>
                <!-- /.box-body -->
            </div>
        </div>
    </div>

    <!--第三行-->
    <div class="row">
        <div class="col-md-6">
            <div class="box" style="border-top: 0px; ">
            <div class="box-header with-border text-center" style="border-top-right-radius:3px;border-top-left-radius:3px;background-color: #58B5FB;color:#f0f0f0; height: 50px;">


                <h1 class="box-title " style="font-size: 25px;line-height:1.1;">预算核算进度总览</h1>
            </div>
            <div class="box-header with-border text-center" style="border-top-right-radius:3px;border-top-left-radius:3px;background-color: #fff;color:#f0f0f0; height: 50px;">
                <div class="form-group col-md-5">
                    <label class="col-md-4 control-label" style="margin-top: 6px;padding-left: 0; padding-right: 0; color: #333;">开始日期</label>
                    <div class="col-md-8" style="padding-left: 0;">
                        <input type="text" class="form-control datepicker" name="contYear" id="beginDT" autocomplete="off" placeholder="开始日期" th:value="${beginDT}" style="width: 110px;"/>
                    </div>
                </div>
                <div class="form-group col-md-5">
                    <label class="col-md-4 control-label" style="margin-top: 6px; padding-left: 0; padding-right: 0;color: #333;">结束日期</label>
                    <div class="col-md-8" style="padding-left: 0;">
                        <input type="text" class="form-control datepicker" name="contYear" id="endDT" autocomplete="off" placeholder="结束日期" th:value="${endDT}" style="width: 110px;"/>
                    </div>
                </div>
                <button type="button" class="btn" id="btn-search" style="margin-top: 0px; background-color: #58B5FB;" onclick="reloadWeekData()">
                    <!--<i class="fa fa-search"></i>-->
                    <span class="Bold" style="color: #fff;">开始统计</span>
                </button>
            </div>
                <div class="box-body">
                <table class="table table-bordered">

                    <tr>
                        <th colspan="6" class="text-center">成本预算</th>
                        <th colspan="5" class="text-center">成本核算</th>
                    </tr>
                    <tr>
                        <td class="text-center">年份</td>
                        <td class="text-center">项目总数</td>
                        <td class="text-center">已完成</td>
                        <td class="text-center">未开始</td>
                        <td class="text-center">执行中</td>
                        <td class="text-center">本周完成</td>

                        <td class="text-center">项目总数</td>
                        <td class="text-center">已完成</td>
                        <td class="text-center">未开始</td>
                        <td class="text-center">执行中</td>
                        <td class="text-center">本周完成</td>
                    </tr>
                    <tbody  id="weekTable1">
                    <tr th:each="barInfo:${barInfo}">
                        <td th:text="${barInfo.years}">2018（前）</td>
                        <td th:text="${barInfo.allcnts}">1115</td>
                        <td th:text="${barInfo.okcnt1}">1089</td>
                        <td th:text="${barInfo.uncnt1}">25</td>
                        <td th:text="${barInfo.ing1}">1</td>
                        <td th:text="${barInfo.onCnt1}"></td>

                        <td th:text="${barInfo.allcnts}">1115</td>
                        <td th:text="${barInfo.okcnt6}">1089</td>
                        <td th:text="${barInfo.uncnt6}">25</td>
                        <td th:text="${barInfo.ing6}">1</td>
                        <td th:text="${barInfo.onCnt6}"></td>
                    </tr>

                    </tbody></table>
            </div>
            <!-- /.box-body -->
        </div>
        </div>
        <div class="col-md-6">
            <div class="box" style="border-top: 0px; ">
                <div class="box-header with-border text-center" style="border-top-right-radius:3px;border-top-left-radius:3px;background-color: #58B5FB;color:#f0f0f0; height: 50px;">
                    <h1 class="box-title " style="font-size: 25px;line-height:1.1;">合同签订进度总览</h1>
                </div>
                <div class="box-header with-border text-center" style="border-top-right-radius:3px;border-top-left-radius:3px;background-color: #fff;color:#f0f0f0; height: 50px;">

                </div>
                <div class="box-body">
                    <table class="table table-bordered">

                        <tr>
                            <th colspan="6" class="text-center">合同报价</th>
                            <th colspan="5" class="text-center">合同签订</th>
                        </tr>
                        <tr>
                            <td class="text-center">年份</td>
                            <td class="text-center">项目总数</td>
                            <td class="text-center">已完成</td>
                            <td class="text-center">未开始</td>
                            <td class="text-center">执行中</td>
                            <td class="text-center">本周完成</td>

                            <td class="text-center">项目总数</td>
                            <td class="text-center">已完成</td>
                            <td class="text-center">未开始</td>
                            <td class="text-center">执行中</td>
                            <td class="text-center">本周完成</td>
                        </tr>
                        <tbody  id="weekTable2">
                        <tr th:each="barInfo:${barInfo}">
                            <td th:text="${barInfo.years}">2018（前）</td>
                            <td th:text="${barInfo.allcnts}">1115</td>
                            <td th:text="${barInfo.okcnt2}">1089</td>
                            <td th:text="${barInfo.uncnt2}">25</td>
                            <td th:text="${barInfo.ing2}">1</td>
                            <td th:text="${barInfo.onCnt2}"></td>

                            <td th:text="${barInfo.allcnts}">1115</td>
                            <td th:text="${barInfo.okcnt3}">1089</td>
                            <td th:text="${barInfo.uncnt3}">25</td>
                            <td th:text="${barInfo.ing3}">1</td>
                            <td th:text="${barInfo.onCnt3}"></td>
                        </tr>
                        </tbody></table>
                </div>
                <!-- /.box-body -->
            </div>
        </div>
    </div>

</section>

<div th:include="include :: footer"></div>
<script th:inline="javascript">

    /**
     * 初始化就加载数据
     */

    js.post({
        url: ctx + "main/selGroupTaskList",
        data:null,
        success: function (result) {
            if(result.data.rows.length>1){
                var titles=new Array();
                var dataWanCheng=new Array();
                var dataWeiWanCheng=new Array();

                for ( var i = 0; i < result.data.rows.length; i++){
                    titles[i]=result.data.rows[i].groupName;
                    dataWanCheng[i]=Number(result.data.rows[i].okCnt);
                    dataWeiWanCheng[i]=Number(result.data.rows[i].unCnt);
                }
                demo2(titles,dataWanCheng,dataWeiWanCheng);
            }
        }
    });

    function demo2(titles,okList,unList) {
        var itemStyle = {
            //柱形图圆角，鼠标移上去效果，如果只是一个数字则说明四个参数全部设置为那么多
            emphasis: {
                barBorderRadius: 30
            },

            normal: {
                //柱形图圆角，初始化效果
                barBorderRadius: [10, 10, 10, 10],
                label: {
                    show: true,//是否展示
                    textStyle: {
                        fontWeight: 'bolder',
                        fontSize: '12',
                        fontFamily: '微软雅黑'
                    }
                }
            }
        }

        option = {
            tooltip: {
                trigger: 'axis',
                axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                    type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                }
            },
            legend: {
                data: ['已完结', '未完成',]
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: {
                type: 'value'
            },
            yAxis: {
                type: 'category',
                data: titles
            },
            series: [
                {
                    name: '已完结',
                    type: 'bar',
                    stack: '总量',
                    label: {
                        show: true,
                        position: 'insideRight'
                    },
                    data: okList,
                    itemStyle: {//柱图背景色
                        color: '#F39C12'
                    },
                    barWidth: '25px'
                },
                {
                    name: '未完成',
                    type: 'bar',
                    stack: '总量',
                    label: {
                        show: true,
                        position: 'insideRight'
                    },
                    data: unList,
                    itemStyle: {//柱图背景色
                        color: '#D2D6DE'
                    },
                }

            ]
        };

        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    }


    // myChart.on('click', function (params) {
    //     // 控制台打印数据的名称
    //     console.log(params);
    // });

    /**
     * 表格数据统计
     */
    function reloadWeekData() {
        if($("#beginDT").val()==""){
            js.modal.warning("请选择开始日期");
            return false;
        }
        if($("#endDT").val()==""){
            js.modal.warning("请选择结束日期");
            return false;
        }
        js.post({
            url: ctx + "main/selWeekDataList",
            data:{"beginDT":$("#beginDT").val(),"endDT":$("#endDT").val()},
            success: function (result) {
                if(result.data.rows.length>1){
                    var weekTable1="";
                    var weekTable2="";

                    for (var i = 0; i < result.data.rows.length; i++){
                        weekTable1+="<tr>";
                        weekTable1+="<td>"+result.data.rows[i].years+"</td>";
                         weekTable1+="<td>"+result.data.rows[i].allcnts+"</td>";
                         weekTable1+="<td>"+result.data.rows[i].okcnt1+"</td>";
                         weekTable1+="<td>"+result.data.rows[i].uncnt1+"</td>";
                         weekTable1+="<td>"+result.data.rows[i].ing1+"</td>";
                         weekTable1+="<td>"+result.data.rows[i].onCnt1+"</td>";
                         weekTable1+="<td>"+result.data.rows[i].allcnts+"</td>";
                         weekTable1+="<td>"+result.data.rows[i].okcnt6+"</td>";
                         weekTable1+="<td>"+result.data.rows[i].uncnt6+"</td>";
                         weekTable1+="<td>"+result.data.rows[i].ing6+"</td>";
                         weekTable1+="<td>"+result.data.rows[i].onCnt6+"</td>";
                         weekTable1+="</tr>";

                        weekTable2+="<tr>";
                        weekTable2+="<td>"+result.data.rows[i].years+"</td>";
                        weekTable2+="<td>"+result.data.rows[i].allcnts+"</td>";
                        weekTable2+="<td>"+result.data.rows[i].okcnt2+"</td>";
                        weekTable2+="<td>"+result.data.rows[i].uncnt2+"</td>";
                        weekTable2+="<td>"+result.data.rows[i].ing2+"</td>";
                        weekTable2+="<td>"+result.data.rows[i].onCnt2+"</td>";
                        weekTable2+="<td>"+result.data.rows[i].allcnts+"</td>";
                        weekTable2+="<td>"+result.data.rows[i].okcnt3+"</td>";
                        weekTable2+="<td>"+result.data.rows[i].uncnt3+"</td>";
                        weekTable2+="<td>"+result.data.rows[i].ing3+"</td>";
                        weekTable2+="<td>"+result.data.rows[i].onCnt3+"</td>";
                        weekTable2+="</tr>";

                    }
                    $("#weekTable1").html(weekTable1);
                    $("#weekTable2").html(weekTable2);
                }
            }
        });
    }

    $(document).ready(function(){
        if($("#beginDT").val()!="" && $("#endDT").val()!=""){
            reloadWeekData();
        }
    });

    /**
     * 初始化时候，加载项目总数
     */
    js.post({
        url: ctx + "main/selAllData",
        data:null,
        success: function (result) {
            if(result.data!='' && result.data!=null){
                $("#all_02").html(result.data.allCnt);
                $("#all_03").html(result.data.okCnt);
                $("#all_01").html(result.data.unCnt);

            }
        }
    });
    /**
     * 初始化调用年份
     */
    selYear($("#year").html());
    selMonth($("#year").html()+"-"+$("#month").html());
    /**
     * 年份的项目数量
     */
    function selYear(year){
        js.post({
            url: ctx + "main/selDataByYear",
            data:{"year":year},
            success: function (result) {
                if(result.data!='' && result.data!=null){
                    $("#year_02").html(result.data.allCnt);
                    $("#year_03").html(result.data.okCnt);
                    $("#year_01").html(result.data.unCnt);

                }
            }
        });
    }
    /**
     * 月份的项目数量
     */
    function selMonth(month){
        js.post({
            url: ctx + "main/selDataByMonth",
            data:{"month":month},
            success: function (result) {
                if(result.data!='' && result.data!=null){
                        $("#month_02").html(result.data.allCnt);
                        $("#month_03").html(result.data.okCnt);
                        $("#month_01").html(result.data.unCnt);
                }
            }
        });
    }

    /**
     * 下一年
     * @returns {boolean}
     */
    function nextYear(){
        var year=parseInt($("#year").html())+1;
        //获取完整的日期

        var date=new Date;

        var y = date.getFullYear()

        if(parseInt(year)>parseInt(y)){
            js.modal.warning(year+"那一年，我在去时的路上");
            return false;
        }
        else{
            $("#year").html(year);
            selYear(year);
        }
    }
    /**
     * 下一年
     * @returns {boolean}
     */
    function preYear(){
        var year=parseInt($("#year").html())-1;
        // alert(year);
        //获取完整的日期

        var date=new Date;

        var y = date.getFullYear()

        if(parseInt(year)>parseInt(y)){
            js.modal.warning(year+"那一年，我在去时的路上");
            return false;
        }
        else{
            $("#year").html(year);
            selYear(year);
        }
    }

    /**
     * 下月
     */
    function nextMonth() {

        var month=parseInt($("#month").html())+1;

        //获取完整的日期
        var date=new Date;
        var y = date.getFullYear()
        var now_month = date.getMonth() + 1;

           if(month>12){
               var year=parseInt($("#year").html())+1;
               // alert(year);

               if(parseInt(year)>parseInt(y)){
                   js.modal.warning("时间都去哪了，转眼一个月就过去了");
                   return false;
               }else{
                   $("#year").html(year);
                   selYear(year);
                   selMonth($("#year").html()+"-01");
                   $("#month").html("01");
                   return false;
               }
           }

           if($("#year").html()==y){
                if(parseInt(month)>parseInt(now_month)){
                    js.modal.warning("时间都去哪了，转眼一个月就过去了");
                    return false;
                }else{
                    selMonth($("#year").html()+"-"+autoMonth(month));
                    $("#month").html(autoMonth(month));
                    return false;
                }
           }

        if($("#year").html()<y){
            selMonth($("#year").html()+"-"+autoMonth(month));
            $("#month").html(autoMonth(month));
            return false;
        }

    }
    /**
     * 上月
     */
    function preMonth() {
        var month=parseInt($("#month").html())-1;

        //获取完整的日期
        var date=new Date;
        var y = date.getFullYear()
        var now_month = date.getMonth() + 1;

        if(month<1){
            var year=parseInt($("#year").html())-1;
            $("#year").html(year);
            selYear(year);
            selMonth($("#year").html()+"-12");
            $("#month").html("12");
            return false;
        }
        else{
            selMonth($("#year").html()+"-"+autoMonth(month));
            $("#month").html(autoMonth(month));
            return false;
        }
    }

    function autoMonth(m){
        var mm=m;
        if(m<10){
            mm='0'+m;
        }
        return mm;
    }

</script>

</body>
</html>